#ifndef Action_h
#define Action_h

#include "Export.h"
#include "EventScheme.h"
#include "MQOBJECT.h"
#include <list>
#include <string>

class INFOBUS_API Step
{
public:
  Step(long lStep, const char* pszDesc, const char* pszCommand = NULL);
  Step::Step(const Step* pOther);
  ~Step();

  long getStepNo() const { return m_lStep; }
  const char* getDescription() const { return m_szDescription; }
  const char* getCommand() const { return m_szCommand; } 
private:
  long m_lStep;
  char m_szDescription[1024];
  char m_szCommand[1024];
};

class INFOBUS_API Action : public MessageQueueObject
{
public:
  Action();
  Action(const char* szExec, 
         const char* szEventName, 
         const char* szSeqName, 
         const char* szActionName,
         const char* szSeverity);
  Action(const Action * pOther);
  //~Action();

  const char* getExecutable() const { return m_szExec; }
  const char* getEventName() const { return m_szEventName; }
  const char* getSeqName() const { return m_szSeqName; }
  const char* getActionName() const { return m_szActionName; }
  const char* getActionTime() const { return m_szActionTime; }
  const char* getSeverity() const { return m_szSeverity; }
  const char* getEventCategory() const { return m_szEventCategory; }
  const char* toXml(const char* pszEvent=NULL);

  EventScheme* getEventScheme() { return m_pEventScheme; }

  std::list<Step*>& getSteps() { return m_liSteps; }

  bool isValid()
  {
    if (!strcmp("", m_szExec) || 
      !strcmp("", m_szActionName)) {
      return false;
    } else {
      return true;
    }
  }

  void setEventCategory(const char* szEventCategory);
  void setActionTime(const char* szActionTime);
  void addStep(Step * pStep);
  void addEvent(EventScheme * pEventScheme);
private:
  char m_szExec[256+1];
  char m_szEventName[256+1];
  char m_szEventCategory[256+1];
  char m_szSeqName[50+1];
  char m_szSeverity[50+1];
  char m_szActionName[256+1];
  char m_szActionTime[100+1];
  char * m_pszXml;

  std::list<Step*> m_liSteps;
  EventScheme * m_pEventScheme;
};


#endif